# uncomment for test coverage information
#   $$ gcov -f stree    
#   $$ more stree.c.gcov
#COVFLAGS=-fprofile-arcs -ftest-coverage

CC= gcc
CFLAGS = -Wall -pedantic -g $(COVFLAGS)

objects = stree-test.o stree.o
exe = stree

# lista di file da consegnare (.c e .h)
FILE_DA_CONSEGNARE="./stree.c"

.PHONY: cleanall test clean consegna docu

$(exe) : $(objects)
	$(CC) $(CFLAGS) $(objects) -o $(exe)
stree-test.o: stree-test.c my_tree.h stree.h
stree.o: stree.c my_tree.h

########### NON MODIFICARE DA QUA IN POI ############################################
# genera la documentazione con doxygen
docu: Doxyfile
	-rm -fr html
	doxygen

# effettua il test
test: $(exe)
	@echo MALLOC_TRACE=$(MALLOC_TRACE)
	-rm -f ./mtrace.log
	./$(exe) 
	mtrace ./$(exe) ./mtrace.log
	@echo -e "\a\n **** Test superato! ****\n"

SUBJECT1="lcs07: consegna primo frammento"
#effettua il test e la consegna
consegna:
	make clean
	make test
	./gruppo-check.pl < gruppo.txt
	tar -cvf $(USER)-f1.tar ./gruppo.txt $(FILE_DA_CONSEGNARE) ./Makefile
	mpack -s $(SUBJECT1) ./$(USER)-f1.tar  susanna@di.unipi.it
	@echo -e "\a\n*** PRIMO FRAMMENTO CONSEGNATO! ***\n"

clean:
	-rm -f *.o *~ ./core 

cleanall:
	-rm -f *.o *~ ./core $(exe) 
